#ifndef TRACKER_H
#define TRACKER_H

#include <QObject>
#include "main.h"
#include <QVector>

class mythread;

struct IO
{

    bool bottom_water_level:1;
    bool top_water_level:1;
    bool colling_water_switch:1;
    bool inter_pressure_switch:1;   
    bool water_valve:1;
    bool heating_valve:1;
    bool air_intake_valve:1;
    bool exhaust_valve:1;
    bool Vacuum_pump:1;
    bool air_supply_valve:1;

    bool front_door_closed_in_place_switch:1;
    bool front_door_opened_in_place_switch:1;
    bool front_door_Sealing_strip_pressure:1;
    bool back_door_opened_in_place_switch:1;
    bool back_door_closed_in_place_switch:1;
    bool back_door_Sealing_strip_pressure_in_place_switch:1;
    bool open_front_door_valve:1;
    bool close_front_door_valve:1;
    bool front_door_Sealing_strip_Inflation_valve:1;
    bool front_door_Sealing_strip_Exhaust_valve:1;
    bool open_back_door_valve:1;
    bool close_back_door_valve:1;
    bool back_door_Sealing_strip_Inflation_valve:1;
    bool back_door_Sealing_strip_Exhaust_valve:1;
    //bool overpressure_protection_switch_isreached_switch:1;

    char status:8;

};

union IO_union{
 IO iobs;
 int integer_value;
};

//struct track_data
//{
//int second_inc;
//int pressure;
//float temprature;
//IO iobs;
//};

class tracker : public QObject
{
    Q_OBJECT
public:
    explicit tracker(QObject *parent = 0);
    ~tracker();
    void start_track();
    void stop_track();
    void read_IO();

   QDateTime startTime;
   QList < QVector<int> > track_data_list;
   IO_union IOUN;

signals:
    
public slots:

private:
    int IObuffer;
    int secs;
    QTimer* timer;

    QVector<int> vector;
    bool multi_jump;

private slots:
    void time_done();

    
};

QDataStream &operator<<(QDataStream &, const tracker &);
QDataStream &operator>>(QDataStream &, tracker &);
void readfrom(QString strTemp,tracker &track);
void writeto(QString strTemp,tracker &track);



#endif // TRACKER_H
